home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / iutil / trim_relna.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  838 b   |  49 lines

  1. # include    <ingres.h>
  2. # include    <sccs.h>
  3.  
  4. SCCSID(@(#)trim_relna.c    8.1    12/31/84)
  5.  
  6. /*
  7. **  TRIM_RELNM -- trim blanks from relation name for printing
  8. **
  9. **    A relation name (presumably in 'ingresname' format: MAXNAME
  10. **    characters long with no terminating null byte) has the
  11. **    trailing blanks trimmed off of it into a local buffer, so
  12. **    that it can be printed neatly.
  13. **
  14. **    Parameters:
  15. **        name -- a pointer to the relation name
  16. **
  17. **    Returns:
  18. **        a pointer to the trimmed relation name.
  19. **
  20. **    Side Effects:
  21. **        none
  22. */
  23.  
  24. char *
  25. trim_relname(name)
  26. char    *name;
  27. {
  28.     register char    *old, *new;
  29.     register int    i;
  30.     static char    trimname[MAXNAME + 1];
  31.  
  32.     if ( name == (char *) 0 )
  33.         return ( "" );
  34.     old = name;
  35.     new = trimname;
  36.     i = MAXNAME;
  37.  
  38.     while (i--)
  39.         if ((*new++ = *old++) == ' ')
  40.         {
  41.             new--;
  42.             break;
  43.         }
  44.  
  45.     *new = '\0';
  46.  
  47.     return (trimname);
  48. }
  49.